<div class="layui-form" id="form" lay-filter="game_form">
    <div class="form-cont">
        <div class="layui-form-item verify">
            <label class="layui-form-label">活动名称</label>
            <div class="layui-input-block" style="margin-left: 0px;width:280px;float:left;">
                <input type="text" name="game_name" verify="require" v-model="detail.game_name" placeholder="请输入名称"
                       class="layui-input">
                <span class="hint">活动名称必填</span>
            </div>
        </div>
        <div class="layui-form-item verify">
            <label class="layui-form-label">排名</label>
            <div class="layui-input-block" style="margin-left: 0px;width:180px;float:left;">
                <input type="number" verify="require" name="ranking" v-model="detail.ranking" placeholder="请输入排名"
                       oninput="if(value>8)value=8" class="layui-input">
                <span class="hint">活动名次必填</span>
            </div>
            <label class="layui-form-label" style="margin-left: 0px;width:80px;">赠送网费</label>
            <div class="layui-input-block" style="width:180px;float:left;">
                <input type="number"  name="internet_fee" verify="require" v-model="detail.internet_fee" placeholder="请输入赠送网费" class="layui-input">
                <span class="hint">网费赠送必填</span>
            </div>
        </div>
        <div class="layui-form-item verify">
            <label class="layui-form-label">最低段位</label>
            <div class="layui-input-block">
                <div class="layui-unselect layui-form-select" style="width:100px;float:left;">
                    <div class="layui-select-title">
                        <input type="text" name='grading_name' :data='detail.grading' placeholder="请选择玩家最低段位" class="layui-input layui-unselect" readonly>
                        <i class="layui-edge"></i>
                    </div>
                    <dl class="layui-anim layui-anim-upbit">
                        <dd :data='index+1' v-for="(x,index) in grading">{{x}}</dd>
                    </dl>
                </div>
                <label class="layui-form-label" style="width:60px;">最低血量</label>
                <input type="number" v-model="detail.blood_volume" placeholder="最低血量" oninput="if(value>100)value=100"
                       class="layui-input" style="width:130px;float:left;">
            </div>
        </div>






        <div class="layui-form-item verify">
            <label class="layui-form-label">星级额外奖励</label>
            <div class="layui-inline" style="margin-left: 15px;">
                <button class="layui-btn" id="add_star">新增</button>
            </div>
            <div id="star_details">

            </div>
        </div>
        <div class="layui-form-item verify">
            <label class="layui-form-label">段位额外奖励</label>
            <div class="layui-inline" style="margin-left: 15px;">
                <button class="layui-btn" id="add_grade">新增</button>
            </div>
            <div id="grade_details">

            </div>
        </div>

        <div class="layui-form-item verify">
            <label class="layui-form-label">活动时间类型</label>
            <div class="layui-input-block">
                <div class="layui-unselect layui-form-select" style="width:100px;float:left;">
                    <div class="layui-select-title">
                        <input type="text" name='time_type_name' :data='detail.time_type'
                               placeholder="请选择活动时间"
                               class="layui-input layui-unselect" verify="require" readonly>
                        <i class="layui-edge"></i>
                    </div>
                    <dl class="layui-anim layui-anim-upbit">
                        <dd class="layui-select-tips layui-this"  data='' @click="timeType(this)">请选择</dd>
                        <dd :data='index+1' v-for="(x,index) in time_type" @click="timeType(this)">{{x}}</dd>
                    </dl>
                </div>
            </div>
        </div>


        <div class="layui-form-item verify">
            <label class="layui-form-label">开始时间</label>
            <div class="layui-input-block" style="margin-left: 0px;width:180px;float:left;">
                <input type="text" id='time' name='start_time' placeholder="请选择时间" verify="require" class="layui-input" readonly>
            </div>
            <label class="layui-form-label" style="margin-left: 0px;width:80px;">结束时间</label>
            <div class="layui-input-block" style="margin-left: 0px;width:180px;float:left;">
                <input type="text" id='times' name='end_time' placeholder="请选择时间" verify="require" class="layui-input" readonly>
            </div>
        </div>

        <div class="layui-form-item time_type_one time_type_hide">
            <label class="layui-form-label">每周</label>
            <div class="layui-input-block">
                <input type="checkbox" v-for="(x,index) in weeks" class="week_one" :value="index" name="week[]" :title="x">
            </div>
        </div>
        <div class="layui-form-item time_type_one time_type_hide">
            <label class="layui-form-label">每月</label>
            <div class="layui-input-block">
                <input type="checkbox" v-for="(name,key) in months" class="month_one" name="month[]" :value="key" :title="name">
            </div>
        </div>
        <div class="layui-form-item time_type_one time_type_hide">
            <label class="layui-form-label">特定日期</label>
            <div class="layui-inline">
                <input type="text" class="layui-input test-item" name="special_date" id="special_date"
                       placeholder="yyyy-MM-dd">
            </div>

        </div>

        <div class="layui-form-item time_type_one time_type_hide">
            <label class="layui-form-label">特定时间段</label>
            <div class="layui-inline">
                <input type="text" class="layui-input test-item" name="special_date_line" id="special_date_line"
                       placeholder="yyyy-MM-dd">
            </div>

        </div>

        <div class="layui-form-item verify">
            <label class="layui-form-label">优先级</label>
            <div class="layui-input-block">
                <input type="text" id='sort' name='sort' value="1" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item verify">
            <label class="layui-form-label">是否排位赛</label>
            <div class="layui-input-block">
                <div name="is_rank" class="layui-unselect layui-form-switch" :class="{'layui-form-onswitch':detail.is_rank==1}"
                     lay-skin="_switch" @click="radioF1()"><em>{{detail.is_rank==1?'是':'否'}}</em><i></i></div>
            </div>
        </div>
        <div class="layui-form-item verify">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
<!--                <input type="checkbox" name="status" lay-skin="switch" lay-text="启用|停用" value="1"  @click="radioF()">-->
                <div name="status" class="layui-unselect layui-form-switch" :class="{'layui-form-onswitch':detail.status==1}"
                     lay-skin="_switch" @click="radioF()"><em>{{detail.status==1?'启用':'停用'}}</em><i></i>
                </div>
            </div>
        </div>
    </div>
    <div class="form-btn" v-if="type!=3">
        <input type="button" value="保存" class="layui-btn" @click="submit">
    </div>
</div>
<script id="demo1" type="text/html">
    {{# layui.each(d.data, function(index, item){     }}
    <div class="star_one">
               <label class="layui-form-label" style="clear: both">段位</label>
               <div class="layui-input-block">
                       <div class="layui-unselect layui-form-select" style="width:100px;float:left;">
                               <div class="layui-select-title">
                                   {{# layui.each(d.grading, function(key, val){     }}
                                   {{# if(key+1==item.gradings_extra){ }}
                                   <input type="text"   placeholder="段位" data="{{key+1}}" value="{{val}}"
                                          class="layui-input layui-unselect star_one_input gradings_extra" readonly>
                                   <i class="layui-edge"></i>
                                   {{#  }  }}
                                   {{#  })  }}
                                   </div>
                               <dl class="layui-anim layui-anim-upbit">
                                   {{# layui.each(d.grading, function(key, val){     }}
                                       {{# if(key>1){  }}
                                              {{# if(key==item.gradings_extra){ }}
                                                        <dd data={{key+1}}  class="layui-this">
                                               {{# }else{  }}
                                                    <dd data={{key+1}} >
                                               {{#  }  }}
                                                            {{val}}</dd>
                                        {{# } }}
                                   {{#  })  }}

                                   </dl>
                           </div>
                       <label class="layui-form-label" style="width:100px;">额外赠送网费</label>
                       <input type="number"  placeholder="额外赠送网费"
                              class="layui-input star_one_input gradings_fee" style="float:left;" value="{{item.gradings_fee}}">
                        <div class=" lay-btn layui-btn-danger ewai_del" >删除</div>
                   </div>
           </div>
    {{# });  }}
</script>
<script id="demo" type="text/html">
    {{# layui.each(d.data, function(index, item){     }}
    <div class="star_one">
                <div class="layui-input-block">
                        <div class="layui-unselect layui-form-select" style="width:100px;float:left;">
                                <div class="layui-select-title">
                                        <input type="text"   placeholder="单价"
                                               class="layui-input layui-unselect star_one_input star_jiage" verify="require"
                                               value="{{item.jiage}}费"
                                               data="{{item.jiage}}" readonly>
                                        <i class="layui-edge"></i>
                                    </div>
                                <dl class="layui-anim layui-anim-upbit">

                                    {{# if(item.jiage=="1"){ }}
                                    <dd data=1  class="layui-this">1费</dd>
                                    {{# }else{ }}
                                    <dd data=1  >1费</dd>
                                    {{# } }}

                                    {{# if(item.jiage=="2"){ }}
                                    <dd data=2  class="layui-this">2费</dd>
                                    {{# }else{ }}
                                    <dd data=2  >2费</dd>
                                    {{# } }}

                                    {{# if(item.jiage=="3"){ }}
                                    <dd data=3  class="layui-this">3费</dd>
                                    {{# }else{ }}
                                    <dd data=3  >3费</dd>
                                    {{# } }}

                                    {{# if(item.jiage=="4"){ }}
                                    <dd data=4  class="layui-this">4费</dd>
                                    {{# }else{ }}
                                    <dd data=4  >4费</dd>
                                    {{# } }}

                                    {{# if(item.jiage=="5"){ }}
                                    <dd data=5  class="layui-this">5费</dd>
                                    {{# }else{ }}
                                    <dd data=5  >5费</dd>
                                    {{# } }}
                                    </dl>
                        </div>
                        <div class="layui-unselect layui-form-select" style="width:100px;float:left;">
                                <div class="layui-select-title">
                                        <input type="text"   placeholder="星级"
                                               class="layui-input layui-unselect star_one_input star"    value="{{item.jiage}}星"
                                               data="{{item.star}}" verify="require" readonly>
                                        <i class="layui-edge"></i>
                                    </div>
                                <dl class="layui-anim layui-anim-upbit">
                                    {{# if(item.star=="1"){ }}
                                    <dd data=1  class="layui-this">1星</dd>
                                    {{# }else{ }}
                                    <dd data=1  >1星</dd>
                                    {{# } }}

                                    {{# if(item.star=="2"){ }}
                                    <dd data=2  class="layui-this">2星</dd>
                                    {{# }else{ }}
                                    <dd data=2  >2星</dd>
                                    {{# } }}
                                    {{# if(item.star=="3"){ }}
                                    <dd data=3  class="layui-this">3星</dd>
                                    {{# }else{ }}
                                    <dd data=3  >3星</dd>
                                    {{# } }}

                                    </dl>
                        </div>
                        <input type="number"  placeholder="英雄数量" oninput="if(value>8)value=8" value="{{item.num}}"
                               class="layui-input star_one_input num" verify="require" style="float:left;">
                        <input type="number"  placeholder="额外赠送网费"
                               class="layui-input star_one_input star_fee" verify="require" style="float:left;"value="{{item.star_fee}}">
                         <div class=" lay-btn layui-btn-danger ewai_del">删除</div>
                </div>
    </div>
    {{# });  }}

</script>
<style type="text/css">
    .form-cont {
        overflow: auto;
    }

    .star_one_input {
        width: 100px;
    }

    .star_one {
        clear: both;
        margin-left: 45px;
    }

    .time_type_hide {
        display: none;
    }

    .time_type_show {
        display: block;
    }
    .ewai_del{
        width: 50px;
        float: left;
        height: 35px;
        line-height: 35px;
        text-align: center;
        margin-left: 5px;
    }
</style>

<script>
    layui.use(['form', 'upload','laytpl', 'layer', 'laydate'], function () {
        var $ = layui.$
            , form = layui.form, upload = layui.upload, layer = layui.layer, laytpl=layui.laytpl,laydate = layui.laydate;
        ;
        form.verify(layui.admin.verify);
        var forms = new Vue({
            el: '#form',
            data: {
                role: [],
                group: [],
                type: layui.admin.objData.type,
                detail: {
                    status: 1,//状态
                    star: '',//
                    start_time: '00:00:00',//每天开始时间
                    end_time: '23:59:59',//每天结束时间
                    is_rank:2,//是否排位赛
                    time_type: '',//活动时间类型
                    game_name:'',//活动名称
                    internet_fee:'',//赠送金额
                    grading:1,
                    ranking:'',//排名
                    weeks:'',
                    months:''
                },
                old_detail: {},
                layer: '',
                star: '',
                time_type_val: '',
                select: ['一星', '二星', '三星'],
                grading: ['无限制', '无段位', '黑铁', '青铜', '白银', '黄金', '白金', '钻石', '大师', '宗师', '王者'],
                time_type: ['每天', '每周', '每月', '特定日期','特定时间段'],
                // weeks: {
                //     'week[1]': '周一',
                //     'week[2]': '周二',
                //     'week[3]': '周三',
                //     'week[4]': '周四',
                //     'week[5]': '周五',
                //     'week[6]': '周六',
                //     'week[7]': '周日'
                // },
                weeks: {
                    1: '周一',
                    2: '周二',
                    3: '周三',
                    4: '周四',
                    5: '周五',
                    6: '周六',
                    7: '周日'
                },
                months: {
                    1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 10, 11: 11, 12: 12, 13: 13, 14: 14, 15: 15
                    , 16: 16, 17: 17, 18: 18, 19: 19, 20: 20, 21: 21, 22: 22, 23: 23, 24: 24, 25: 25, 26: 26, 27: 27, 28: 28, 29: 29, 30: 30
                    , 31: 31
                }
            },
            mounted() {
                //初始化
                laydate.render({
                    elem: '#time',
                    type: 'time'
                });
                //初始化
                laydate.render({
                    elem: '#times',
                    type: 'time'
                });
                //日期选择器
                laydate.render({
                    elem: '#special_date'
                    //,type: 'date' //默认，可不填
                });
//日期范围选择
                laydate.render({
                    elem: '#special_date_line'
                    ,range: "~" //或 range: '~' 来自定义分割字符
                });
                var _this = this;


                //初始化
                if (this.type != 1) this.detail = layui.admin.objData.detail, this.old_detail = JSON.stringify(layui.admin.objData.detail);
                if (this.detail.weeks){
                    var week_arr=this.detail.weeks.split(',');
                    for (var i=0;i<7;i++){
                        if (week_arr.indexOf($(".week_one").eq(i).val())>=0){
                            $(".week_one").eq(i).attr('checked',true);
                        }
                    }
                }
                if (this.detail.months){
                    var month_arr=this.detail.months.split(',');
                    for (var i=0;i<31;i++){
                        if (month_arr.indexOf($(".month_one").eq(i).val())>=0){
                            $(".month_one").eq(i).attr('checked',true);
                        }
                    }
                }
                //第三步：渲染模版

                var getTpl = demo.innerHTML
                    ,view = $("#star_details"),tpl=[];
                tpl.data=this.detail.stars_extra_arr;
                laytpl(getTpl).render(tpl, function(html){
                    view.html(html);
                    form.render();
                });
                var getTpl1 = demo1.innerHTML
                    ,view1 = $("#grade_details"),tpl1=[];
                tpl1.data=this.detail.gradings_extra_arr;
                tpl1.grading=this.grading;
                laytpl(getTpl1).render(tpl1, function(html){
                    view1.html(html);
                    form.render();
                });
                console.log(this.detail); console.log(1212)
                var form_val=this.detail;
                form_val.grading_name=this.grading[form_val.grading-1];
                form_val.time_type_name=this.time_type[form_val.time_type-1];
                if (form_val.time_type&&form_val.time_type!=1) {
                    $(".time_type_one").eq(form_val.time_type - 2).removeClass('time_type_hide').addClass('time_type_show');
                }
                form.val('game_form',this.detail)
                // $('input[name="star"]').val(this.select[this.detail.star - 1]);
                // $('input[name="start_time"]').val(this.detail.start_time);
                // $('input[name="end_time"]').val(this.detail.end_time);
                form.render();
                //console.log(this.detail)
            },
            methods: {

                timeType: function (dome) {
                    var _this = this;
                    var el = event.currentTarget;
                    var time_type = $(el).attr('data');
                    var input_time_type = $("input[name='time_type']").attr('data');
                    //$("input[name='time_type']").eq(0).val(time_type);
                    console.log(time_type);
                    console.log($("input[name='time_type']").eq(0).val())
                    _this.detail.time_type = time_type;
                    if (time_type == input_time_type) return false;
                    $(".time_type_one").removeClass('time_type_show').addClass('time_type_hide');
                    if (time_type!=1) {
                        $(".time_type_one").eq(time_type - 2).removeClass('time_type_hide').addClass('time_type_show');
                    }
                },
                radioF: function () {//radio选择
                    this.detail.status == 1 ? this.detail.status = 2 : this.detail.status = 1;
                },
                radioF1: function () {//radio选择
                    this.detail.is_rank == 1 ? this.detail.is_rank = 2 : this.detail.is_rank = 1;
                },
                submit: function () {
                    if (layui.admin.form('#form')) {
                        if (this.photos) {
                            this.layer = layer.load(1);
                            this.upload.upload();
                        } else {
                            this.submits();
                        }
                    }
                },
                submits: function () {
                    if (layui.admin.form('#form')) {
                        var time_val;
                        var data1 = form.val("game_form");
                        //console.log($("input[name='month[]']"));

                        var week=[],month=[];
                        for (var i in  data1){
                            if (i.indexOf('week[')>=0){
                                week.push(data1[i]);
                                delete data1[i];
                            }
                            if (i.indexOf('month[')>=0){
                                month.push(data1[i]);
                                delete data1[i];
                            }
                        }
                        data1.time_type=$("input[name='time_type_name']").eq(0).attr('data');
                        if (data1.time_type==2&&week.length<1){
                            layer.open({
                                title: '提示'
                                ,content: '周必须选择一天或一天以上'
                            });
                            return  false;
                        }
                        if (data1.time_type==3&&month.length<1){
                            layer.open({
                                title: '提示'
                                ,content: '月必须选择一天或一天以上'
                            });
                            return  false;
                        }
                        if (data1.time_type==4&&!data1.special_date){
                            layer.open({
                                title: '提示'
                                ,content: '选择特定日期'
                            });
                            return  false;
                        }
                        if (data1.time_type==5&&!data1.special_date_line){
                            layer.open({
                                title: '提示'
                                ,content: '选择特定时间日期'
                            });
                            return  false;
                        }
                        if (week.length>0){
                            data1.weeks=week.join(',');
                        }
                        if (month.length>0){
                            data1.months=month.join(',');
                        }
                        if (data1.time_type==5){
                            data1.special_star_date=data1.special_date_line.split("~")[0];
                            data1.special_end_date=data1.special_date_line.split("~")[1];
                            delete  data1['special_date_line'];
                        }
                      //  data1.grading=$("input[name='grading']").eq(0).attr('data');
                        var star_arr=$("#star_details .star_one");
                        if (star_arr.length>0){
                            var star_details={};
                            for (var i=0;i<star_arr.length;i++){
                                star_details[i]={};
                                star_details[i].jiage=$(star_arr[i]).find('.star_jiage').eq(0).attr('data');
                                 star_details[i].star=$(star_arr[i]).find('.star').eq(0).attr('data');
                                 star_details[i].num= $(star_arr[i]).find('.num').eq(0).val();
                                 star_details[i].star_fee=$(star_arr[i]).find('.star_fee').eq(0).val();
                            }
                            data1.stars_extra=JSON.stringify(star_details);
                        }
                        var grade_details_arr=$("#grade_details .star_one");
                        if (grade_details_arr.length>0){
                            var grad_details={};
                            for (var i=0;i<grade_details_arr.length;i++){
                                grad_details[i]={};
                                grad_details[i].gradings_extra=$(grade_details_arr[i]).find('.gradings_extra').eq(0).attr('data');
                                grad_details[i].gradings_fee= $(grade_details_arr[i]).find('.gradings_fee').eq(0).val();
                            }

                            data1.gradings_extra=JSON.stringify(grad_details);//grad_details.toJSONString();
                        }

                        data1.time_type=$("input[name='time_type_name']").eq(0).attr('data');

                        data1.grading=$("input[name='grading_name']").eq(0).attr('data');
                        delete this.detail['grading_name'];
                        delete this.detail['time_type_name'];
                        delete data1['grading_name'];
                        delete data1['time_type_name'];
                        data1.grading=parseInt(data1.grading);
                        data1.internet_fee=parseInt(data1.internet_fee);
                        data1.ranking=parseInt(data1.ranking);
                        data1.time_type=parseInt(data1.time_type);
                        console.log(data1);
                        Object.assign(this.detail,data1);
                        for (var j in this.detail){
                            if (!this.detail[j]){
                                delete this.detail[j];
                            }
                        }
                        if (this.type == 2) {   //编辑
                            var data = layui.admin.filter(this.detail, JSON.parse(this.old_detail), 'id');

                            if (data) {
                                layui.admin.formapi('gentinggame/update', data);
                            }
                        } else {  //添加
                            //console.log(this.detail);
                            layui.admin.formapi('gentinggame/add', this.detail);
                        }
                    }
                }
            }
        })
        $("#add_star").click(function () {
            $("#star_details").append(' <div class="star_one">\n' +
                '        <div class="layui-input-block">\n' +
                '            <div class="layui-unselect layui-form-select" style="width:100px;float:left;">\n' +
                '                <div class="layui-select-title">\n' +
                '                    <input type="text"   placeholder="单价"\n' +
                '                           class="layui-input layui-unselect star_one_input star_jiage" verify="require" readonly>\n' +
                '                    <i class="layui-edge"></i>\n' +
                '                </div>\n' +
                '                <dl class="layui-anim layui-anim-upbit">\n' +
                '                    <dd class="layui-select-tips layui-this">请选择</dd>\n' +
                '                    <dd data=\'1\' >1费</dd>\n' +
                '                    <dd data=\'2\' >2费</dd>\n' +
                '                    <dd data=\'3\' >3费</dd>\n' +
                '                    <dd data=\'4\' >4费</dd>\n' +
                '                    <dd data=\'5\' >5费</dd>\n' +
                '                </dl>\n' +
                '            </div>\n' +
                '            <div class="layui-unselect layui-form-select" style="width:100px;float:left;">\n' +
                '                <div class="layui-select-title">\n' +
                '                    <input type="text"   placeholder="星级"\n' +
                '                           class="layui-input layui-unselect star_one_input star" verify="require" readonly>\n' +
                '                    <i class="layui-edge"></i>\n' +
                '                </div>\n' +
                '                <dl class="layui-anim layui-anim-upbit">\n' +
                '                    <dd class="layui-select-tips layui-this">请选择</dd>\n' +
                '                    <dd data=\'1\' >1星</dd>\n' +
                '                    <dd data=\'2\' >2星</dd>\n' +
                '                    <dd data=\'3\' >3星</dd>\n' +
                '                </dl>\n' +
                '            </div>\n' +
                '            <input type="number"  placeholder="英雄数量" oninput="if(value>8)value=8"\n' +
                '                   class="layui-input star_one_input num" verify="require" style="float:left;">\n' +
                '            <input type="number"  placeholder="额外赠送网费"\n' +
                '                   class="layui-input star_one_input star_fee" verify="require" style="float:left;">\n' +
                '             <div class=" lay-btn layui-btn-danger ewai_del">删除</div>\n'+
                '        </div>\n' +
                '    </div>')
        });
        $("#add_grade").click(function () {
            $("#grade_details").append(' <div class="star_one">\n' +
                '        <label class="layui-form-label" style="clear: both">段位</label>\n' +
                '        <div class="layui-input-block">\n' +
                '            <div class="layui-unselect layui-form-select" style="width:100px;float:left;">\n' +
                '                <div class="layui-select-title">\n' +
                '                    <input type="text"   placeholder="段位"\n' +
                '                           class="layui-input layui-unselect star_one_input gradings_extra" readonly>\n' +
                '                    <i class="layui-edge"></i>\n' +
                '                </div>\n' +
                '                <dl class="layui-anim layui-anim-upbit">\n' +
                '                    <dd class="layui-select-tips layui-this">请选择</dd>\n' +
                '                    <dd data=\'3\' >黑铁</dd>\n' +
                '                    <dd data=\'4\' >青铜</dd>\n' +
                '                    <dd data=\'5\' >白银</dd>\n' +
                '                    <dd data=\'6\' >黄金</dd>\n' +
                '                    <dd data=\'7\' >白金</dd>\n' +
                '                    <dd data=\'8\' >钻石</dd>\n' +
                '                    <dd data=\'9\' >大师</dd>\n' +
                '                    <dd data=\'10\' >宗师</dd>\n' +
                '                    <dd data=\'11\' >王者</dd>\n' +
                '                </dl>\n' +
                '            </div>\n' +
                '            <label class="layui-form-label" style="width:100px;">额外赠送网费</label>\n' +
                '            <input type="number"  placeholder="额外赠送网费"\n' +
                '                   class="layui-input star_one_input gradings_fee" style="float:left;">\n' +
                '             <div class=" lay-btn layui-btn-danger ewai_del" >删除</div>\n'+
                '        </div>\n' +
                '    </div>')
        })
        $('.layui-form').on('click','.ewai_del',function (){
            $(this).parent().parent().remove();
        })
    });
</script>
